using System;

using OpenTK;

namespace ColladaDotNet.SimpleMesh
{
	public struct Mapping : IEquatable<Mapping>
	{
		public Vector3d TexCoord;

		public Vector3d Tangent;

		public Vector3d Binormal;

		/// <summary>
		/// Indicates whether the current object is equal to another object of the same type.
		/// </summary>
		/// <returns>
		/// true if the current object is equal to the other parameter; otherwise, false.
		/// </returns>
		/// <param name="obj">An object to compare with this object.</param>
		public bool Equals(Mapping obj)
		{
			return obj.TexCoord.Equals(TexCoord) && obj.Tangent.Equals(Tangent) && obj.Binormal.Equals(Binormal);
		}

		/// <summary>
		/// Indicates whether this instance and a specified object are equal.
		/// </summary>
		/// <returns>
		/// true if obj and this instance are the same type and represent the same value; otherwise, false.
		/// </returns>
		/// <param name="obj">Another object to compare to. </param><filterpriority>2</filterpriority>
		public override bool Equals(object obj)
		{
			if (obj.GetType() != typeof(Mapping))
			{
				return false;
			}
			return Equals((Mapping)obj);
		}

		/// <summary>
		/// Returns the hash code for this instance.
		/// </summary>
		/// <returns>
		/// A 32-bit signed integer that is the hash code for this instance.
		/// </returns>
		/// <filterpriority>2</filterpriority>
		public override int GetHashCode()
		{
			unchecked
			{
				int result = TexCoord.GetHashCode();
				result = (result * 397) ^ Tangent.GetHashCode();
				result = (result * 397) ^ Binormal.GetHashCode();
				return result;
			}
		}

		public static bool operator ==(Mapping left, Mapping right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(Mapping left, Mapping right)
		{
			return !left.Equals(right);
		}
	}
}